<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Verifies that a password matches a hash</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.sodium-crypto-pwhash-str-verify" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sodium_crypto_pwhash_str_verify</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.2.0)</p><p class="refpurpose"><span class="refname">sodium_crypto_pwhash_str_verify</span> &mdash; <span class="dc-title">Verifies that a password matches a hash</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.sodium-crypto-pwhash-str-verify-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>sodium_crypto_pwhash_str_verify</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$hash</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$password</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Checks that a password hash created using <span class="function"><a href="sodium_crypto_pwhash_str.html" class="function">sodium_crypto_pwhash_str()</a></span> matches a given plain_text password. Note that the parameters are in the opposite order to the same parameters in the similar <span class="function"><a href="password_hash.html" class="function">password_hash()</a></span> function.
  </p>


 </div>


 <div class="refsect1 parameters" id="refsect1-function.sodium-crypto-pwhash-str-verify-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<code class="parameter">hash</code></dt>

    <dd>

     <p class="para">
      一个由 <span class="function"><a href="password_hash.html" class="function">password_hash()</a></span> 创建的散列值。
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">password</code></dt>

    <dd>

     <p class="para">
      用户的密码。
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.sodium-crypto-pwhash-str-verify-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> if the password and hash match, or <strong><code>FALSE</code></strong> otherwise.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.sodium-crypto-pwhash-str-verify-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Hashes are calculated using the Argon2ID algorithm, providing resistance to both GPU and side-channel attacks.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.sodium-crypto-pwhash-str-verify-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="sodium_crypto_pwhash_str.html" class="function" rel="rdfs-seeAlso">sodium_crypto_pwhash_str()</a> - Get an ASCII-encoded hash</span></li>
    <li class="member"><span class="function"><a href="password_hash.html" class="function" rel="rdfs-seeAlso">password_hash()</a> - 创建密码的散列（hash）</span></li>
    <li class="member"><span class="function"><a href="password_verify.html" class="function" rel="rdfs-seeAlso">password_verify()</a> - 验证密码是否和散列值匹配</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>